package com.istar.framework.dao.interfaces;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

public interface ICommonDao<T> {
	/**
	 * This is an inteface support all methods. In this ICommonDao, we will
	 * support all of common method. It reaches something that executes directly
	 * database layer
	 */

	/**
	 * Insert database
	 */
	boolean insert(T entity);

	/**
	 * update database
	 */
	boolean update(T entity);

	/**
	 * delete database
	 */
	boolean delete(int id);

	/**
	 * Get List Of Database
	 */
	List<T> listAll();

	/**
	 * Get Id from Database
	 */
	T get(int id);
	
	/**
	 * Load list base on criteria and projection
	 */
	List<T> getListByCriteria(DetachedCriteria detachedCriteria);

	List<T> getListByCriteria(DetachedCriteria detachedCriteria, int offset,
			int size);

}
